home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
music
/
musgfa.zoo
/
musex2.lst
< prev
next >
Wrap
File List
|
1992-12-24
|
10KB
|
407 lines
' musex2.gfa by Seymour Shlien/ 624 Courtenay Avenue / Ottawa, Canada, K2A 3B5
' december 20 1992
DIM topname$(32)
DIM botname$(32)
DIM but_left%(32),but_right%(32),but_top%(32),but_bot%(32)
DIM but_status%(32)
DIM sel_left%(16),sel_right%(16),sel_top%(16),sel_bot%(16)
DIM top_sel_name$(16),bot_sel_name$(16)
DIM int_list%(11),key_list%(12),d_list%(2)
octave%=4
tone%=2
chord%=0
@load_names
sel_num%=0
DEFMOUSE 0
DO WHILE sel_num%<>bot_panel%+1
@display_all_selectors
sel_num%=@selector
IF sel_num%=bot_panel%+2
@instructions
ELSE
@make_board
@display_board
@exercise
ENDIF
LOOP
> PROCEDURE load_names
LOCAL i%,istart%,iend%
istart%=0
iend%=10
'
' intervals
FOR i%=istart% TO iend%
READ botname$(i%)
NEXT i%
FOR i%=istart% TO iend%
READ topname$(i%)
NEXT i%
FOR i%=istart% TO iend%
but_left%(i%)=MOD(i%,4)*80+5
but_right%(i%)=MOD(i%,4)*80+72
but_top%(i%)=(i% DIV 4)*28
but_bot%(i%)=(i% DIV 4)*28+24
but_status%(i%)=0
NEXT i%
istart%=iend%+1
iend%=iend%+12
'
' keys
FOR i%=istart% TO iend%
READ topname$(i%)
NEXT i%
FOR i%=istart% TO iend%
but_left%(i%)=MOD(i%-istart%,4)*30+5
but_right%(i%)=MOD(i%-istart%,4)*30+28
but_top%(i%)=((i%-istart%) DIV 4)*28+85
but_bot%(i%)=((i%-istart%) DIV 4)*28+20+85
but_status%(i%)=0
NEXT i%
istart%=iend%+1
iend%=iend%+2
'
' ascend/descend
FOR i%=istart% TO iend%
READ topname$(i%)
NEXT i%
iend%=iend%+3
FOR i%=istart% TO iend%
but_left%(i%)=160+80*MOD(i%-istart%,2)
but_right%(i%)=but_left%(i%)+72
but_top%(i%)=((i%-istart%) DIV 2)*20+85
but_bot%(i%)=but_top%(i%)+16
but_status%(i%)=0
NEXT i%
topname$(iend%-2)="octave 4"
topname$(iend%-1)="tone "+STR$(tone%)
topname$(iend%)=" broken"
botname$(iend%)=" chord"
but_bot%(iend%)=but_top%(iend%)+24
istart%=iend%+1
iend%=iend%+3
bot_panel%=istart%
but_status%(3)=1
but_status%(5)=1
but_status%(11)=1
but_status%(23)=1
FOR i%=istart% TO iend%
READ topname$(i%)
NEXT i%
FOR i%=istart% TO iend%
but_left%(i%)=(i%-istart%)*70+5
but_right%(i%)=but_left%(i%)+60
but_top%(i%)=170
but_bot%(i%)=182
but_status%(i%)=0
NEXT i%
but_right%(iend%)=but_left%(iend%)+110
istart%=iend%
DATA second,second,third,third,fourth,fifth,sixth,sixth,seventh,seventh,octave
DATA minor,major,minor,major,perfect,perfect,minor,major,minor,major,
DATA C,C#,D,D#,E,F,F#,G,G#,A,A#,B
DATA ascend,descend
DATA ready,quit,instructions
RETURN
> PROCEDURE display_selector(i%)
BOX but_left%(i%),but_top%(i%),but_right%(i%),but_bot%(i%)
DEFFILL but_status%(i%)
PBOX but_left%(i%)+1,but_top%(i%)+1,but_right%(i%)-1,but_bot%(i%)-1
GRAPHMODE 2
DEFTEXT 1-but_status%(i%)
TEXT but_left%(i%)+5,but_top%(i%)+8,topname$(i%)
TEXT but_left%(i%)+5,but_top%(i%)+18,botname$(i%)
RETURN
> PROCEDURE display_all_selectors
LOCAL i%
CLS
FOR i%=0 TO 30
display_selector(i%)
NEXT i%
RETURN
> FUNCTION select_button
LOCAL i%
SHOWM
REPEAT
UNTIL MOUSEK<>0
FOR i%=0 TO 30
IF MOUSEX>but_left%(i%)
IF MOUSEX<but_right%(i%)
IF MOUSEY>but_top%(i%)
IF MOUSEY<but_bot%(i%)
IF i%>=0 AND i%<25
but_status%(i%)=1-but_status%(i%)
@make_board
IF int_size%>0 AND key_size%>0 AND d_size%>0
@display_selector(i%)
ELSE
but_status%(i%)=1-but_status%(i%)
ENDIF
ENDIF
IF i%=25
INC octave%
IF octave%>5
octave%=3
ENDIF
topname$(i%)="octave "+STR$(octave%)
@display_selector(i%)
ENDIF
IF i%=26
tone%=MOD(tone%+1,3)
topname$(i%)="tone "+STR$(tone%)
@display_selector(i%)
ENDIF
IF i%=27
chord%=1-chord%
IF chord%=1
topname$(i%)=""
ELSE
topname$(i%)=" broken"
ENDIF
@display_selector(i%)
ENDIF
PAUSE 20
RETURN i%
ENDIF
ENDIF
ENDIF
ENDIF
NEXT i%
RETURN -1
ENDFUNC
> FUNCTION selector
LOCAL i%
REPEAT
i%=@select_button
IF i%=bot_panel%+1
END
ENDIF
UNTIL i%>27
RETURN i%
ENDFUNC
> PROCEDURE make_board
LOCAL i%
int_size%=0
FOR i%=0 TO 10
IF but_status%(i%)=1
int_list%(int_size%)=i%
sel_left%(int_size%)=MOD(int_size%,4)*80+5
sel_right%(int_size%)=MOD(int_size%,4)*80+72
sel_top%(int_size%)=(int_size% DIV 4)*32+96
sel_bot%(int_size%)=(int_size% DIV 4)*32+24+96
top_sel_name$(int_size%)=topname$(i%)
bot_sel_name$(int_size%)=botname$(i%)
int_size%=int_size%+1
ENDIF
NEXT i%
sel_left%(int_size%)=5
sel_right%(int_size%)=80
sel_top%(int_size%)=10
sel_bot%(int_size%)=34
top_sel_name$(int_size%)="quit"
bot_sel_name$(int_size%)=""
sel_left%(int_size%+1)=85
sel_right%(int_size%+1)=170
sel_top%(int_size%+1)=10
sel_bot%(int_size%+1)=34
top_sel_name$(int_size%+1)="repeat"
bot_sel_name$(int_size%+1)=""
sel_left%(int_size%+2)=175
sel_right%(int_size%+2)=225
sel_top%(int_size%+2)=10
sel_bot%(int_size%+2)=34
top_sel_name$(int_size%+2)="help"
bot_sel_name$(int_size%+2)=""
key_size%=0
FOR i%=11 TO 22
IF but_status%(i%)=1
key_list%(key_size%)=i%-10
INC key_size%
ENDIF
NEXT i%
d_size%=0
FOR i%=23 TO 24
IF but_status%(i%)=1
d_list%(d_size%)=i%-22
INC d_size%
ENDIF
NEXT i%
RETURN
> PROCEDURE display_sel(i%,highlight%)
GRAPHMODE 2
IF (i%<25)
DEFFILL highlight%
DEFTEXT 1-highlight%
BOX sel_left%(i%),sel_top%(i%),sel_right%(i%),sel_bot%(i%)
PBOX sel_left%(i%)+1,sel_top%(i%)+1,sel_right%(i%)-1,sel_bot%(i%)-1
TEXT sel_left%(i%)+5,sel_top%(i%)+8,top_sel_name$(i%)
TEXT sel_left%(i%)+5,sel_top%(i%)+18,bot_sel_name$(i%)
ENDIF
RETURN
> PROCEDURE display_board
LOCAL i%
CLS
FOR i%=0 TO int_size%+2
display_sel(i%,0)
NEXT i%
RETURN
> PROCEDURE interval(note1%,octave1%,note2%,octave2%)
IF chord%=0
SOUND 0,10,note1%,octave1%,0
WAVE 1,3,0,1000+3000*tone%,25
SOUND 0,10,note2%,octave2%,0
WAVE 1,3,0,1000+3000*tone%,25
SOUND 0,0,note1%,octave1%,0
ELSE
SOUND 1,10,note1%,octave1%,0
SOUND 2,10,note2%,octave2%,0
WAVE 3,3,0,3000*(tone%+1),25
SOUND 1,0,note1%,octave1%,0
SOUND 2,0,note1%,octave1%,0
ENDIF
RETURN
> FUNCTION select_answer
LOCAL i%
SHOWM
REPEAT
UNTIL MOUSEK<>0
FOR i%=0 TO 16
IF MOUSEX>sel_left%(i%)
IF MOUSEX<sel_right%(i%)
IF MOUSEY>sel_top%(i%)
IF MOUSEY<sel_bot%(i%)
PAUSE 20
RETURN i%
ENDIF
ENDIF
ENDIF
ENDIF
NEXT i%
RETURN -1
ENDFUNC
> PROCEDURE exercise
LOCAL i%,note1%,note2%,octave1%,octave2%
LOCAL int%
correct%=0
total%=0
REPEAT
INC total%
trys%=0
octave1%=octave%
octave2%=octave%
note1%=RANDOM(key_size%)
note1%=key_list%(note1%)
d%=RANDOM(d_size%)
d%=d_list%(d%)
int%=RANDOM(int_size%)
note2%=int_list%(int%)+1
IF d%=1
note2%=note1%+note2%
ELSE
note2%=note1%-note2%
ENDIF
IF note2%>12
note2%=note2%-12
octave2%=octave2%+1
ENDIF
IF note2%<1
note2%=note2%+12
octave2%=octave2%-1
ENDIF
@interval(note1%,octave1%,note2%,octave2%)
REPEAT
ans%=@select_answer
IF ans%=int_size%+1
@interval(note1%,octave1%,note2%,octave2%)
ENDIF
IF ans%=int_size%+2
@help(note1%,octave1%,d%)
ENDIF
INC trys%
LOCATE 1,7
IF ans%=int%
PRINT SPACE$(10);
ELSE IF ans%<>int_size%
PRINT SPACE$(10);
@interval(note1%,octave1%,note2%,octave2%)
LOCATE 1,7
PRINT "TRY AGAIN";
ENDIF
UNTIL ans%=int% OR ans%=int_size%
IF trys%=1 AND ans%<>int_size%
INC correct%
LOCATE 1,7
PRINT "good"
LOCATE 1,8
PRINT "score =";correct%;"/";total%;
PAUSE 25
ENDIF
UNTIL ans%=int_size%
CLS
RETURN
> PROCEDURE instructions
CLS
PRINT " MUSICAL INTERVAL RECOGNITION 92-12-20"
PRINT
PRINT "This is an ear training exercise for"
PRINT "developing the ability to identify the"
PRINT "musical intervals. For example a "
PRINT "perfect fifth is the interval between C"
PRINT "and G or D and A. The program plays an"
PRINT "inteval using the Atari sou